<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Dynamic Report</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      letter-spacing: 2px;
    }

    .box {
      margin: 0;
      padding: 20px;
      background: linear-gradient(#978df3, #a8beee);
    }

    .container {
      max-width: 1200px;
      margin: 0 auto;
    }

    .each {
      padding: 20px;
      margin: 20px 0;
      border-radius: 10px;
      background-color: #fff;
    }

    .tran-code {
      background-color: #fff;
      width: 100%;
      border-collapse: collapse;
      border: 1px solid #000;
    }

    .tran-code th, .tran-code td {
      border: 1px solid #000;
      padding: 8px;
      text-align: center;
    }

    .tran-code th {
      background-color: #978df3;
      color: #fff;
      font-weight: bold;
    }

    .tran-code td {
      background-color: #f2f2f2;
    }

    .header {
      text-align: center;
      font-size: 25px;
      color: #fff;
      text-shadow: -1px -1px 0 #4134f3, 1px -1px 0 #4134f3, -1px 1px 0 #4134f3, 1px 1px 0 #4134f3;
    }

    .header > p {
      color: #fff;
    }

    .title {
      font-weight: bolder;
      color: #978df3;
    }

    .date {
      font-size: 19px;
    }

    h3 {
      line-height: 50px;
      font-size: 19px;
      padding: 0 20px;
      color: #fff;
      background-color: #978df3;
      text-shadow: -1px -1px 0 #4134f3, 1px -1px 0 #4134f3, -1px 1px 0 #4134f3, 1px 1px 0 #4134f3;
    }

    h4 {
      margin-top: 20px;
      font-size: 17px;
      color: #4134f3;
      display: flex;
      align-items: center;
    }

    h4::before {
      content: "★ ";
      color: #978df3;
      margin-right: 5px;
    }

    .vertical-table {
      width: 100%;
      border-collapse: collapse;
    }

    .vertical-table th, .vertical-table td {
      border: 1px solid #000;
      padding: 8px;
      text-align: left;
    }

    .vertical-table th {
      background-color: #978df3;
      color: #fff;
    }
  </style>
</head>
<body>
<div class="box">
  <div class="container">
    <div class="header">
      <h2>分布式核心系统运行日报</h2>
      <p>日期: <span th:text="${date}"></span></p>
    </div>
    <!-- Iterate over major tables (e.g., 联机交易, 系统交易表) -->
    <div th:each="majorTableEntry : ${tableDataMap}">
      <div class="each">
        <h3 th:text="${majorTableEntry.key}"></h3>
        <!-- Iterate over each transaction code or system metrics -->
        <div th:each="entry : ${majorTableEntry.value}">
          <h4 th:text="'Transaction Code: ' + ${entry.key}"></h4>
          <table class="tran-code" th:if="${entry.value != null}">
            <thead>
            <tr>
              <th th:each="header : ${entry.value[0]}" th:text="${header}"></th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="row, status : ${entry.value}" th:if="${status.index > 0}">
              <td th:each="cell : ${row}" th:text="${cell}"></td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>
